package controllers

type Response struct {
	ErrorCode    int         `json:"error_code"`
	ErrorMessage string      `json:"error_message"`
	Data         interface{} `json:"data,omitempty"`
}

type ResponseErrorMessge struct {
	ErrorCode    int
	ErrorMessage string
}

var (
	jsonError = ResponseErrorMessge{ErrorCode: 100, ErrorMessage: "json object faild"}
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	userError   = ResponseErrorMessge{ErrorCode: 200, ErrorMessage: "user service faild"}
	userIdError = ResponseErrorMessge{ErrorCode: 200, ErrorMessage: "user id faild"}
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	heartError = ResponseErrorMessge{ErrorCode: 300, ErrorMessage: "heart service faild"}
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	registerError    = ResponseErrorMessge{ErrorCode: 400, ErrorMessage: "register service faild"}
	creatIdError     = ResponseErrorMessge{ErrorCode: 401, ErrorMessage: "create id faild"}
	licenseCodeError = ResponseErrorMessge{ErrorCode: 402, ErrorMessage: "license code faild"}
	savelicenseError = ResponseErrorMessge{ErrorCode: 403, ErrorMessage: "save license faild"}
	serviceError     = ResponseErrorMessge{ErrorCode: 490, ErrorMessage: "system exception faild"}
)

func (lr *Response) setErrorObject(err ResponseErrorMessge) {

	lr.ErrorMessage = err.ErrorMessage
	lr.ErrorCode = err.ErrorCode
}

func (lr *Response) setErrorMessage(message string) {

	lr.ErrorMessage = message
}
func (lr *Response) setErrorCode(code int) {

	lr.ErrorCode = code
}
func (lr *Response) setData(data interface{}) {
	lr.Data = data
}
